package com.gitee.feizns.explore.data_structure.array.easy;

/**
 * 268. 缺失数字
 * @author feizns
 * @since 2020/1/9
 */
public class MissingNumber {

    public static void main(String[] args) {

    }

    public static int missingNumber(int[] num) {
        int[] n = new int[num.length + 1];
        for (int i = 0; i < num.length; i++) {
            n[num[i]] = 1;
        }
        for (int i = 0; i < n.length; i++) {
            if ( n[i] == 0 )
                return i;
        }
        return -1;
    }

}
